<?php

namespace plugin\muadmin\app\common\core;

class Util
{
    protected static $instance;
    public static function instance($config=[])
    {
        if (!self::$instance) {
            self::$instance = new self($config);
        }
        return self::$instance;
    }
    public static function getPackageVersion($package)
    {
        $installed_php = base_path('vendor/composer/installed.php');
        if (is_file($installed_php)) {
            $packages = include $installed_php;
        }
        return substr($packages['versions'][$package]['version'] ?? 'unknown  ', 0, -2);
    }
}